﻿<%@ Page Title="" Language="C#" MasterPageFile="~/THDC.Master" AutoEventWireup="true" CodeBehind="DangKi.aspx.cs" Inherits="TracNghiemTinHocDaiCuong.DangKi" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server">
    <script type="text/javascript">
        function checkPass() {
            var x = document.getElementById("txtMatKhau").value;
            var y = document.getElementById("txtNhacLaiMatKhau").value;
            if (x != y) {
                $("#lblMatKhau").html("Mật khẩu không khớp");
                return false;
            }
        }
    </script>
    <script type="text/javascript">
        function validateEmail() {
            var x = document.getElementById("txtEmail").value;
            var atpos = x.indexOf("@");
            var dotpos = x.lastIndexOf(".");
            if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
                $("#lblEmail").html("Email chưa đúng");
                return false;
            }
            else
                $("#lblEmail").html("");
        }
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txtNgaySinh").datepicker({
                changeMonth: true,
                changeYear: true,
                yearRange: '-100:+0'
            });
            $("#txtNgaySinh").datepicker("option", "dateFormat", "dd/mm/yy");
//            $("#txtNhacLaiMatKhau").change(function () {
//                checkPass();
//            });
//            $("#txtEmail").change(function () {
//                validateEmail();
//            });
        }); 
    </script>
    <div class="dangKi">
        <table border="0" cellspacing="2px" cellpadding="4px" width="80%" class="table">
        <tr>
            <td colspan="2" class="titlLogin">Đăng kí tài khoản</td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
                
            </td>
        </tr>
    	<tr>
    		<td valign="top">Tên tài khoản</td>
            <td>
                <asp:UpdatePanel runat="server" ID="up1">
                  <ContentTemplate>
                    <asp:TextBox ID="txtTenTaiKhoan" runat="Server" CssClass="txt" AutoPostBack="true"  OnTextChanged="txtTenTaiKhoan_Changed"></asp:TextBox>
                    <div id="divThongBao" runat="server" class="TrungTen"></div><br />
                  </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>Mật khẩu</td>
            <td>
                <asp:TextBox ClientIDMode="Static" ID="txtMatKhau" runat="Server" CssClass="txt" TextMode="Password"></asp:TextBox>
            </td>
        </tr>
                <tr>
            <td>Nhắc lại mật khẩu</td>
            <td>
                <asp:TextBox ID="txtNhacLaiMatKhau" runat="Server" CssClass="txt" TextMode="Password"
                ClientIDMode="Static"></asp:TextBox><br />
                <asp:CompareValidator ID="cvMatKhau" runat="server" 
                ControlToValidate="txtNhacLaiMatKhau" ControlToCompare="txtMatKhau"
                ErrorMessage="Mật khẩu chưa khớp" ForeColor="Red"></asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td>Họ và tên</td>
            <td>
                <asp:TextBox ID="txtHoTen" runat="Server" CssClass="txt"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>Ngày sinh</td>
            <td>
                <asp:TextBox ID="txtNgaySinh" runat="Server" CssClass="txt" ClientIDMode="Static"></asp:TextBox>
            </td>
    	</tr>
        <tr>
            <td>Email</td>
            <td>
                <asp:TextBox ID="txtEmail" runat="Server" CssClass="txt" ClientIDMode="Static"></asp:TextBox>
                <br />
                <asp:RegularExpressionValidator ID="revEmail" runat="server" ErrorMessage="Email chưa đúng" 
                ControlToValidate="txtEmail"  ForeColor="Red"
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                <asp:Label ID="lblEmail" runat="server" ForeColor="Red" ClientIDMode="Static"></asp:Label>
            </td>
    	</tr>
        <tr>
            <td>Giới tính</td>
            <td>
                <asp:RadioButtonList ID="rblGioiTinh" runat="Server" RepeatDirection="Horizontal">
                    <asp:ListItem Selected="True">Nam</asp:ListItem>
                    <asp:ListItem style="margin-left:100px">Nữ</asp:ListItem>
                </asp:RadioButtonList>
            </td>
    	</tr>
        <tr>
            <td>Điện thoại</td>
            <td>
                <asp:TextBox ID="txtDienThoai" runat="Server" CssClass="txt"></asp:TextBox>
                <br />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                ErrorMessage="Số điện thoại chưa đúng" ControlToValidate="txtDienThoai" 
                    ValidationExpression="\d{9,11}" ForeColor="Red"></asp:RegularExpressionValidator>
            </td>
    	</tr>
        <tr>
            <td>Địa chỉ</td>
            <td>
                <asp:TextBox ID="txtDiaChi" runat="Server" CssClass="txt"></asp:TextBox>
            </td>
    	</tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblThongBao" runat="server" CssClass="lblThongBao"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2">
                <asp:Button ID="btnDangKi" runat="Server" Text="Đăng kí" OnClientClick="return validateForm();"
                OnClick="btnDangKi_Click" CssClass="btn"/>
            </td>
        </tr>
    </table>
    </div>
</asp:Content>
